home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 677 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4hs9e3$m1p@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 9 Mar 1996 15:51:31 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 10 Mar 96 02:36:49 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Exceptions: function-try-block
  9. Organization: Sun Microsystems Inc., Mountain View, CA
  10. References: <9603081943.AA02705@dawn.mtest>
  11. X-Newsreader: NN version 6.5.0 #21 (NOV)
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMUJATeEDnX0m9pzZAQEtZgF/Wwd2XERFy9dGqs3Dn+RZzHWMgRyEoUZ7
  14.     bnn11kQd7DK/YpGuT9qy5WJRSCuwg+lO
  15.     =c01U
  16.  
  17. dorgan@mtest.teradyne.com (Don Organ) writes:
  18.  
  19. >They way I interpret all of this is that the following
  20. >should be legal:
  21.  
  22. >class X {
  23. >public:
  24. >    X(int arg1=0);
  25.  
  26. >    int member1;
  27. >    int member2;
  28. >};
  29.  
  30. >X::X(int arg1) try : member1(0), member2(0)
  31. >{
  32. >}
  33. >catch (...) {};
  34.  
  35. >I.e. the try keyword precedes both the colon and the member initializer
  36. >list and the catch keyword is not contained in a block.
  37. >The catch handler would be entered if any exceptions were thrown
  38. >either from the member initializers (not likely in this case since the
  39. >members are simple types) are the body of the constructor.
  40.  
  41. That is correct.
  42.  
  43. >Is there any published material regarding usage of this form?
  44.  
  45. As far as I know, only the draft standard. This new form of try-block
  46. was introduced to solve the problem of exceptions thrown during
  47. member or base initialization, before the body of the constructor
  48. is entered. Previously, there was no way to find out if any such
  49. exceptions occurred or deal with them.
  50.  
  51. >Are there any compilers that support this form?
  52.  
  53. I don't know which ones support it yet, if any. Eventually all will.
  54.  
  55. --
  56. Steve Clamage, stephen.clamage@eng.sun.com
  57. ---
  58. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  59. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  60. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  61. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  62. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  63.